home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 4 / The 640 Meg Shareware Studio CD-ROM Volume IV (Data Express)(1994).ISO / clang / cenvid.zip / KBDBUF.BAT < prev    next >
DOS Batch File  |  1993-06-10  |  2KB  |  52 lines

  1. @echo OFF
  2. REM *******************************************************************
  3. REM *** KbdBuf.bat - CEnvi sample file which will, on most systems, ***
  4. REM ***              increase the keyboard typeahead buffer size.   ***
  5. REM *******************************************************************
  6. @cenvi %0.bat %1 %2
  7. GOTO CENVI_EXIT
  8.  
  9. #define MIN_TYPEAHEAD 1
  10. #define MAX_TYPEAHEAD 127
  11.  
  12. main(argc,argv)
  13. {
  14.    if ( argc != 2  || !strcmpi(argv[1],"/?") )
  15.       Instructions()
  16.    else {
  17.       // check input value for valid range
  18.       typeahead = atoi(argv[1]);
  19.       if ( typeahead < MIN_TYPEAHEAD || MAX_TYPEAHEAD < typeahead ) {
  20.          printf("\aInvalid input value; enter /? for instructions\n");
  21.       } else {
  22.          SetTypeahead(typeahead);
  23.       }
  24.    }
  25. }
  26.  
  27. SetTypeahead(BufSize)   // set size of the typeahead buffer
  28. {
  29.    #define NEXT_CHAR_PTR   0x41A
  30.    #define LAST_CHAR_PTR   0x41C
  31.    #define KYBD_BUF_START_PTR    0x480
  32.    #define KYBD_BUF_END_PTR      0x482
  33.    BufferLocation = ( BufSize <= 15 ) ? 0x1E : 0x200 ;
  34.    poke(NEXT_CHAR_PTR,BufferLocation,UWORD16);
  35.    poke(LAST_CHAR_PTR,BufferLocation,UWORD16);
  36.    poke(KYBD_BUF_START_PTR,BufferLocation,UWORD16);
  37.    poke(KYBD_BUF_END_PTR,BufferLocation+(2*(BufSize+1)),UWORD16);
  38. }
  39.  
  40. Instructions()
  41. {
  42.    printf("\n")
  43.    printf("KbdBuf - Set keyboard typeahead buffer size\n")
  44.    printf("\n")
  45.    printf("USAGE: KbdBuf <size>\n")
  46.    printf("\n")
  47.    printf("Where: size   Size of the typeahead buffer; min = %d max = %d\n",MIN_TYPEAHEAD,MAX_TYPEAHEAD);
  48.    printf("\n")
  49. }
  50.  
  51. :CENVI_EXIT
  52.